import {
    center,
    right,
    grid,
    input,
    header,
    button,
    search,
} from '@/css/VueCss.module.scss' ;
export default {
    title: '销售员',
    items: [{
        region: 'center',
        class: center,
        layout: 'vertical',
        items: [{
            items: [{
                id: 'search',
                class: search,
                widget: 'search',
                text:{
                    field: 'keywords',
                    placeholder: '请输入姓名'
                },
                onSearch: [{
                    action:'grid-load',
                    target:'$widgets.grid',
                    params: '$params'
                }]
            }, {
                class: header,
                layout: 'horizontal',
                items: [{
                    class: button,
                    widget: 'button',
                    value: '新增',
                    onClick: [{
                        action:'dialog-show',
                        path:'Sale/Person/Edit',
                        params: {
                            title: "'新增销售员'"
                        },
                        applyActions: [{
                            action: 'call',
                            target: '$widgets.grid',
                            method: 'reload'
                        }],
                        cancelActions:[{
                            action:'print',
                            description:'取消对话框'
                        }]
                    }]
                }, {
                    class: button,
                    widget: 'button',
                    value: '删除',
                    onClick:[{
                        action:'confirm',
                        title:'删除数据',
                        message:'是否删除勾选数据?',
                        confirm:[{
                            var:'checkedItemIds',
                            action:'array-value',
                            target:'$widgets.grid.checkedItems',
                            key:'id'
                        },{
                            action:'print',
                            description:'列表勾选项',
                            value:'$vars.checkedItemIds'
                        },{
                            action:'service',
                            path: 'crm/sale/allremove',
                            params:{
                                id:'$vars.checkedItemIds'
                            }
                        },{
                            action: 'call',
                            target: '$widgets.grid',
                            method: 'reload'
                        }]
                    }]
                }]
            }]
        },{
            id:'grid',
            class: grid,
            widget:'grid',
            service: 'crm/sale/list',
            pageSize:20,
            columns:[{
                prop:'real_name',
                label:'姓名',
                minWidth: 160
            },'gender',{
                prop:'birthday',
                label:'生日日期',
                minWidth: 180
            },{
                prop:'phone',
                label:'手机号码',
                minWidth: 140
            },{
                prop:'wechat',
                label:'微信号码',
                minWidth: 160
            },{
                prop:'email',
                label:'邮箱地址',
                minWidth: 190
            },{
                prop:'address',
                label:'联系地址',
                minWidth: 150
            },{
                prop:'entry_time',
                label:'入职时间',
                width: 180
            }],
            buttons:[{
                value:'编辑',
                onClick:[{
                    action:'dialog-show',
                    path:'Sale/Person/Edit',
                    params: {
                        title:"'编辑销售员信息'",
                        form: '$params',
                    },
                    applyActions: [{
                        action: 'call',
                        target: '$widgets.grid',
                        method: 'reload'
                    }],
                    cancelActions:[{
                        action:'print',
                        description:'取消对话框'
                    }]
                }]
            },{
                value: '详情',
                onClick: [{
                    action: 'dialog-show',
                    path: 'Sale/Person/Details',
                    params: '$params',
                }]
            },{
                value:'删除',
                type:'danger',
                onClick:[{
                    action:'confirm',
                    title:'删除数据',
                    message:'是否删除该条数据?',
                    confirm:[{
                        action:'service',
                        path:'crm/sale/remove',
                        params: {
                            id:'$params.id'
                        }
                    },{
                        action:'call',
                        target:'$widget',
                        method:'reload'
                    }]
                }]
            }],
            flex:true,
            operationWidth:130,
            operationButtonCount:3,
            enableCheckboxColumn:true,
        }]
    }]
} ;
